<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<body>
<head>
<base href="<%=basePath%>">

<!-- basic styles -->
<!-- <link href="static/css/bootstrap.min.css" rel="stylesheet" /> -->
<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" />
<link rel="stylesheet" href="static/css/font-awesome.min.css" />	
<!-- ace styles -->
<link rel="stylesheet" href="static/css/ace.min.css" />

<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
<!--引入弹窗组件start-->
<script type="text/javascript" src="plugins/attention/zDialog/zDrag.js"></script>
<script type="text/javascript" src="plugins/attention/zDialog/zDialog.js"></script>
<!--引入弹窗组件end-->
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>
<div>
	<div class="name" style="margin-top: 20px;">
	    <span class="input-group-btn">
	 		<a class="btn btn-small btn-success" onclick="generateAllTablesTwoDimensionCode('${organPageData.organid }');">&nbsp;&nbsp;一键生成桌台二维码</a>
	 	</span>
	</div>
	<img src="<%=basePath%>${organPageData.organplane}" width="${organPageData.organ_plane_length}" height="${organPageData.organ_plane_width}" border="0" usemap="#planetmap" alt="Planets"/>
	
	<map name="planetmap" id="planetmap">
		<c:choose>
		<c:when test="${not empty tableList}">
			<c:forEach items="${tableList}" var="table" varStatus="vs">
			<%-- ${table.shape}=${table.position}<p> --%>
				<area shape="${table.shape}" coords="${table.position}" href="javascript:void(0)" onclick="editTable('${table.id}','${table.position}','${table.table_name}','${table.organ_id}');" target="_parent" title="${table.table_name}" alt="${table.table_name}" />
			</c:forEach>
		</c:when>
		</c:choose>
	</map>
</div>
<!-- 引入 -->
<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
<script type="text/javascript" src="static/js/ace.min.js"></script>
<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 单选框 -->
<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
<!-- 引入 -->

<script type="text/javascript">
$(top.hangge());
//修改
function editTable(table_id, position, table_name, organid){
	//window.parent.jzts();
	//alert(position + " - " + table_name + " - " + organid);
	top.jzts();
	var diag = new top.Dialog();
	diag.Drag=true;
	diag.Title ="修改";
	diag.URL = '<%=basePath%>/commercial/tablenew/goEditTable.do?tableid=' + table_id;
	diag.Width = 440;
	diag.Height = 580;
	diag.CancelEvent = function() { //关闭事件
		if (diag.innerFrame.contentWindow.document
				.getElementById('centerOfMainFrame').style.display == 'none') {
			//top.jzts();
			//setTimeout("self.location.reload()", 100);
			bootbox.alert("操作成功！");
		}
		diag.close();
	};
	diag.show();
}

function generateAllTablesTwoDimensionCode(organid){
	bootbox.confirm("确定生成所有桌台的二维码吗?", function(result) {
		if(result) {
			var url = "<%=basePath%>/commercial/tablenew/generateAllTablesTwoDimensionCode.do?organid=" + organid + "&tm="+ new Date().getTime();
			$.get(url,function(data){
				//alert(data);
				//if(data=="success"){
					//top.jzts();
					bootbox.alert("操作成功！");
					//alert("生成成功！");
					//setTimeout("self.location.reload()", 100);
				//}
			});
		}
	});
}
</script>
</body>
</html>
